import {Component, OnInit} from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';

@Component({
  selector: 'app-create-process-config',
  templateUrl: './create-process-config.component.html',
  styleUrls: ['./create-process-config.component.css']
})
export class CreateProcessConfigComponent implements OnInit {

  currentStep = 0;
  applyConfigForm: FormGroup;
  formTemplateForm: FormGroup;
  approveProcessForm: FormGroup;
  disposeProcessForm: FormGroup;
  hasHandleProcess = false;
  listOfData: any[] = [{}];

  drawerVisible = false;

  constructor(private fb: FormBuilder) {
  }

  ngOnInit() {
    this.applyConfigForm = this.fb.group({
      applyConfigName: this.fb.control('', Validators.required),
      applyConfigDesc: this.fb.control(''),
      applyConfigGuide: this.fb.control(''),
      applyConfigAttachment: this.fb.control(''),
      applyConfigDisposeTime: this.fb.control(0),
      applyConfigResponseTime: this.fb.control(0),
      applyConfigAttachmentExpireTime: this.fb.control(0),
    });

    this.formTemplateForm = this.fb.group({
      templateName: this.fb.control('', Validators.required),
      templateDesc: this.fb.control(''),
    });

    this.approveProcessForm = this.fb.group({
      processName: this.fb.control('', Validators.required),
      processId: this.fb.control(''),
    });

    this.disposeProcessForm = this.fb.group({
      disposeProcessName: this.fb.control('', Validators.required),
      disposeProcessId: this.fb.control(''),
    });
  }

  pre() {
    this.currentStep--;
  }

  next() {
    this.currentStep++;
  }

  submit() {

  }

  openDrawer() {
    this.drawerVisible = true;
  }

  closeDrawer() {
    this.drawerVisible = false;
  }
}
